import React, { useEffect, useState } from "react";
import request from "../../axios/api";
import { useParams } from "react-router-dom";
const Index = () => {
  const { id } = useParams();
  console.log(id);
  const [detail, setdetail] = useState({});
  const getData = async () => {
    const res = await request.get("/api/list/detail", { params: { id } });
    const { code, data } = res.data;
    if (code == 200) {
      setdetail(data);
    }
  }
  useEffect(() => {
    getData();
  }, []);
  return (
    <div>
      {
        <div>
          <img src={detail.image}></img>
          <p>{detail.title}</p>
          <p>￥{detail.price}</p>
        </div>
      }
    </div>
  );
};

export default Index;
